#include "widget.h"
#include "set.h"
#include "ui_widget.h"



Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    setWindowTitle("发动机测试");

    //实例化
    wid_set = new set;       // 设置、搜索、连接 界面
    wid_shebei = new shebei;   // 设备控制 界面
    wid_history = new history;   // 历史记录 界面
    wid_pacture = new pacture;   // 监控视频 界面

    //加入堆栈窗体
    ui->stackedWidget->addWidget(wid_set);
    ui->stackedWidget->addWidget(wid_shebei);
    ui->stackedWidget->addWidget(wid_history);
    ui->stackedWidget->addWidget(wid_pacture);

    //连接列表界面和堆栈窗体的信号
    QObject::connect(ui->listWidget, SIGNAL(currentRowChanged(int)),
                     ui->stackedWidget, SLOT(setCurrentIndex(int)));

    // 接收上报数据之后响应的槽函数
    connect(GlobalVal::mqtt,SIGNAL(dataUpSignal(QByteArray)),wid_shebei,SLOT(dataup(QByteArray)));

    // 接收历史数据之后响应的槽函数
    connect(GlobalVal::mqtt,SIGNAL(hissignal(QByteArray)),wid_history,SLOT(hisSlot(QByteArray)));

}

Widget::~Widget()
{
    delete ui;
}


